package online.heycm.rbac.common.config;

import online.heycm.rbac.common.entity.Session;

/**
 * 请求上下文
 *
 * @author hey
 * @version 1.0
 * @date 2024/1/11 12:26
 */
public class RequestContext {
    private static final ThreadLocal<Session> SESSION_THREAD_LOCAL = new ThreadLocal<>();

    private RequestContext() {}

    public static Session get() {
        return SESSION_THREAD_LOCAL.get();
    }

    public static void set(Session session) {
        SESSION_THREAD_LOCAL.set(session);
    }

    public static void remove() {
        SESSION_THREAD_LOCAL.remove();
    }

}
